package cn.sypt.yuhao.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.itcast.jdbc.TxQueryRunner;
import cn.sypt.yuhao.domain.Category;

public class CategoryDao {
	private QueryRunner qr=new TxQueryRunner();
	public List<Category> findAll(){
		String sql="select * from category order by fnum asc";
		try {
			List<Category> categoryList=qr.query(sql, new BeanListHandler<Category>(Category.class));
			return categoryList;
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
}
